-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
percpu reg store this_task #13726
percpu reg store this_task #13726
Conversation
[Experimental Bot, please feedback here] The provided PR description is insufficient based on the NuttX requirements. Here's why and how to improve it: Missing Information
Recommendations
By addressing these points, your PR will be much clearer and easier for the NuttX maintainers to review. |
@@ -226,6 +222,12 @@ int up_cpu_start(int cpu) | |||
|
|||
void arm64_boot_secondary_c_routine(void) | |||
{ | |||
struct tcb_s *tcb = current_task(this_cpu()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think most places use this_task(), does it not work here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it not work here,
Because we need to complete the initialization percpu before using percpu, and this is where the initialization takes place.
e94bbc5
to
4fbf192
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
{ | ||
__asm__ volatile ("msr " "tpidr_el1" ", %0" : : "r" (regs)); | ||
} | ||
#define up_current_regs() (this_task()->xcp.regs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's remove up_current_regs from common code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Next PR
22c21d8
to
d438b57
Compare
reason: We can utilize percpu storage to hold information about the current running task. If we intend to implement this feature, we would need to define two macros that help us manage this percpu information effectively. up_this_task: This macro is designed to read the contents of the percpu register to retrieve information about the current running task.This allows us to quickly access task-specific data without having to disable interrupts, access global variables and obtain the current cpu index. up_update_task: This macro is responsible for updating the contents of the percpu register.It is typically called during initialization or when a context switch occurs to ensure that the percpu register reflects the information of the newly running task. Configuring NuttX and compile: $ ./tools/configure.sh -l qemu-armv8a:nsh_smp $ make Running with qemu $ qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic \ -machine virt,virtualization=on,gic-version=3 \ -net none -chardev stdio,id=con,mux=on -serial chardev:con \ -mon chardev=con,mode=readline -kernel ./nuttx Signed-off-by: hujun5 <[email protected]>
Signed-off-by: hujun5 <[email protected]>
b109c9b
to
10c2253
Compare
…task more earlier. A call stack looks like the following: sched_idletask syslog_write nx_vsyslog syslog getreg64 gic_validate_redist_version arm64_gic_init arm64_gic_secondary_init arm64_boot_secondary_c_routine Signed-off-by: hujun5 <[email protected]>
LGTM |
Summary
We can utilize percpu storage to hold information about the
current running task. If we intend to implement this feature, we would
need to define two macros that help us manage this percpu information
effectively.
up_this_task: This macro is designed to read the contents of the percpu
register to retrieve information about the current
running task.This allows us to quickly access
task-specific data without having to disable interrupts,
access global variables and obtain the current cpu index.
up_update_task: This macro is responsible for updating the contents of
the percpu register.It is typically called during
initialization or when a context switch occurs to ensure
that the percpu register reflects the information of the
newly running task.
Impact
arm64
Testing